package com.base.lib.mvp.present;


import com.base.lib.mvp.interactor.Interactor;
import com.base.lib.mvp.view.IBaseView;

/**
 * @author neo.duan
 * @date 2019/09/09
 * @desc BasePresenterImpl
 */
public abstract class BasePresenterImpl<V extends IBaseView, M extends Interactor> implements BasePresenter {
    public final String TAG = getClass().getSimpleName();
    protected V view;
    protected M interactor;

    public BasePresenterImpl(V view) {
        this.view = view;
        interactor = (M) createInteractor();
    }

    protected abstract Interactor createInteractor();

    @Override
    public void onDestroy() {
        if (view != null) {
            view = null;
        }
        if (interactor != null) {
            interactor.onDestroy();
            interactor = null;
        }
    }
}
